<?php
	
	drupal_set_title('');
	$url = $config->getVar('url');
	drupal_add_js('bdbdec/view/scripts/displayList.js');    
	
	drupal_add_css('bdbdec/view/css/displayList.css', 'theme');    
	
	
	echo '
	<div id="tabs-wrapper" class="clear-block">
		<h2 class="with-tabs">R&eacute;sultats de la recherche "'.$searchfield.'" (Albums)</h2>';
	
	if ($user->isAllowedTo(GRADE_SEARCH_BOOK))
		echo '
		<div class="right">
			<a class="search" ref="#">Recherche rapide</a>
			<div class="searchTabs">
				<form action="'.$url.'/bdbdec.php?action=quickSearch&amp;element=book" method="post" style="margin:0px;">
					<input type="text" name="searchfield" class="searchfield" />
					<select name="element">
						<option value="book" selected="selected">Album</option>
						<option value="serie">S&eacute;rie</option>
						<option value="publisher">Editeur</option>
						<option value="author">Auteur</option>
					</select>
					<input type="submit" value="Valider"><br />
					<small><a href="'.$url.'/bdbdec.php?action=search">Recherche avanc&eacute;e</a></small>
				</form>
			</div>
		</div>';
		echo '
	</div>
	
	<table>
		<thead>
			<tr>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=book&amp;order=al_name&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">Titre</a>
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=book&amp;order=al_tome&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">Vol.</a>
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=book&amp;order=se_name&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">S&eacute;rie</a>
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=book&amp;order=pu_name&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">&Eacute;diteur</a>    
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=book&amp;order=bo_location&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">Emplacement</a>
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=book&amp;order=bo_cotation&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">C&ocirc;te</a>
				</th>
				<th>
					<a href="'.$url.'/bdbdec.php?action='.$action.'&amp;element=book&amp;order=bo_mean&amp;sens='.$sens.'&amp;link='.$link.'&amp;searchfield='.$searchfield.'">Note <sub>/10</sub></a>
				</th>
			</tr>
		</thead>
		<tbody>';
		
		foreach ($elementsList as $album)
		{
			echo '
			<tr class="highlightable">
				<td>
					<a href="'.$url.'/bdbdec.php?action=viewElement&amp;element=book&amp;id='.$album['bo_id'].'">'.stripslashes($album['al_name']).'</a>
				</td>
				<td>
					'.stripslashes($album['al_tome']).'
				</td>
				<td>
					<a href="'.$url.'/bdbdec.php?action=viewElement&amp;element=serie&amp;id='.$album['se_id'].'">'.stripslashes($album['se_name']).'</a>
				</td>
				<td>
					<a href="'.$url.'/bdbdec.php?action=viewElement&amp;element=publisher&amp;id='.$album['pu_id'].'">'.stripslashes($album['pu_name']).'</a>
				</td>
				<td>';
					if ($album['bo_location'] == 'butc')
						echo '&Agrave; la BUTC';
					else if ($album['bo_location'] == 'sortie')
						echo '<b>Sortie</b>';
					else if ($album['bo_location'] == 'cave')
						echo '&Agrave; la cave';
					
				echo '
				</td>
				<td>
					<a href="'.$url.'/bdbdec.php?action=viewElement&amp;element=book&amp;id='.$album['bo_id'].'">'.stripslashes($album['bo_cotation']).'</a>
				</td>
				<td>';
				if (!is_null($album['bo_mean']))
					echo round($album['bo_mean'],2);
				echo '
				</td>
			</tr>';
		}
		echo '
		</tbody>
	</table>
	';

?>